home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 11 / AMUG BBS in a Box Volume XI (April 1994) (MacWizards).iso / Files / Prog / M / LogoMotion101.sit / LogoMation 1.0.1 ƒ / Examples / Hanoi Towers / Hanoi Towers
Encoding:
Text File  |  1993-03-10  |  427 b   |  21 lines  |  [UVtx/UVtl]

  1. Library ":Lib:Hanoi Towers.lib"
  2.  
  3. doPause = 0 // pause after each move, wait for CR
  4. speed1 =   800
  5. speed2 = 1600
  6. thePause = 0.1
  7. N = GetNumberOfTowers()
  8. SetUp()
  9.  
  10. Move(N, 1, 3, 2)
  11.  
  12.  
  13. //       the recursive Move        //
  14. /////////////////////////////
  15. Function Move(n, from, to, using)
  16.     If n = 1
  17.         MoveOne(1,from,to)
  18.     Else
  19.         Move(n-1, from, using, to)
  20.         MoveOne(n,from, to)
  21.         Move(n-1, using, to, from)